package com.bst.web.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.bst.common.annotation.Log;
import com.bst.common.enums.BusinessType;
import com.bst.md.domain.MdIndexLabel;
import com.bst.md.service.IMdIndexLabelService;
import com.bst.common.core.controller.BaseController;
import com.bst.common.core.domain.AjaxResult;

/**
 * 指标标签Controller
 * 
 * @author 老刘
 * @date 2023-02-23
 */
@Controller
@RequestMapping("/md/index/label")
public class MdIndexLabelController extends BaseController
{
    private String prefix = "system/base/label";

    @Autowired
    private IMdIndexLabelService mdIndexLabelService;

    @GetMapping()
    public String label()
    {
        return prefix + "/label";
    }




    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存指标标签
     */
    @Log(title = "指标标签", businessType = BusinessType.INSERT)
    @PostMapping("/save")
    @ResponseBody
    public AjaxResult addSave(@RequestBody MdIndexLabel mdIndexLabel)
    {
        return toAjax(mdIndexLabelService.insertMdIndexLabel(mdIndexLabel));
    }

    /**
     * 删除指标标签
     */
    @Log(title = "指标标签", businessType = BusinessType.DELETE)
    @GetMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(Long idLabel,String idIndex)
    {
        return toAjax(mdIndexLabelService.deleteMdIndexLabelByIdIndexAndIdLabel(idLabel,idIndex));
    }

}
